<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <style></style>
  </head>
  <body>
    <div>
      <h1>Timeline记录内存</h1>
      <p>f12打开开发者工具</p>
      <p>
        选择Performance---打开录制---打开页面进行操作--操作完停止录制---勾选内存选择,查看内存走向图
      </p>
      <button id="btn">add</button>
    </div>
    <script>
      const arrList = [];
      function test() {
        for (let i = 0; i < 100000; i++) {
          document.body.appendChild(document.createElement("p"));
        }
        arrList.push(new Array(1000000).join("x"));
      }
      document.getElementById("btn").addEventListener("click", test);
    </script>
  </body>
</html>
